Skip to content

Add step.sandbox.typescript() - #1784

Merged
jpwilliams merged 25 commits into
jack/sandbox-python-runnerfrom
jack/sandbox-ts-runner
Oct 15, 2026
Merged

jpwilliams merged 25 commits into
jack/sandbox-python-runnerfrom
jack/sandbox-ts-runner

Conversation

@jpwilliams

@jpwilliams jpwilliams commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds step.sandbox.typescript(), a managed-lifecycle Sandbox that runs TypeScript code and can take input.

Direct step usage

Run TS, with the sandbox's lifecycle managed for you.

inputs become variables accessible by the code.

const stats = await step.sandbox.typescript("sum", `
  return numbers.reduce((a: number, b: number) => a + b, 0)
`, {
  input: { numbers: [1, 2, 3] },
});

Reusable functions

Create a reusable function usable during any run.

Output can also be typed and validated using any StandardSchema-compliant schema library.

import { step } from "inngest";
import { z } from "zod";

export const stats = async (id: string, values: number[]) => {
  return step.sandbox.typescript(id, `
    ...
  `, {
    input: { values },
    schema: { output: z.object({ words: z.number() }),
  });
};
// later in a run
const { words } = await stats("get-stats", event.data.body);

Trace

image image

Checklist

  • Added a docs PR that references this PR N/A Later bump
  • Added unit/integration tests
  • Added changesets if applicable

Related

jpwilliams and others added 9 commits October 13, 2026 23:02
Same shape as the Python runner: input as variables, a top-level return as the
result, and a group of kind ts around create, run and destroy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-ts-runner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jpwilliams jpwilliams self-assigned this Oct 14, 2026
@jpwilliams
jpwilliams added this pull request to stack #1785 October 14, 2026 19:09
@inngest-release-bot inngest-release-bot added the 📦 inngest Affects the `inngest` package label Oct 14, 2026
@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adds TypeScript code execution to the sandbox feature.

The advertised output-schema support should be implemented before merging.

Findings

  1. P1 Output schemas are unsupported ▶
Fix with agent prompt
### Issue 1
packages/inngest/src/components/sandbox/types.ts:569
The new `typescript` method uses `SandboxRunner`, whose options do not accept `schema.output`. Users following the schema example in this PR get a TypeScript error, and the result type cannot be inferred from the schema. If a handle caller bypasses the type check, `schema` reaches the strict command-options check and is rejected before the snippet runs.

Add schema support to the runner options, infer the output type, and check the returned value before resolving.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds step.sandbox.typescript() and sandbox.typescript() using the existing runner helpers.

  • Sandbox callers can now run TypeScript through either runner.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["step.sandbox.typescript()"] --> B["Create sandbox"]
  B --> C["Run TypeScript command"]
  D["sandbox.typescript()"] --> C
  C --> E["Read returned JSON"]
  E --> F["Return result"]
  B --> G["Destroy after success or final failure"]
Loading

Reviews (1) · Last reviewed commit: "feat(sandbox): name the TypeScript runne..." · Reviewed by Greptile

Comment thread packages/inngest/src/components/sandbox/types.ts Outdated
@changeset-bot

changeset-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a44bac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
inngest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jpwilliams and others added 11 commits October 14, 2026 19:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs every runner case against real Cloud sandboxes through a devstack Dev
Server: `pnpm -C packages/inngest test:sandbox-live`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Node 26 only strips types, so enums are not supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…suite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jpwilliams and others added 2 commits October 15, 2026 13:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… HEAD

# Conflicts:
#	packages/inngest/src/components/sandbox/runners.test.ts
@jpwilliams
jpwilliams merged commit f5b7109 into main Oct 15, 2026
46 checks passed
@jpwilliams
jpwilliams deleted the jack/sandbox-ts-runner branch October 15, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 inngest Affects the `inngest` package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants